# -*- coding: utf-8 -*-
# created on 2016/9/23


from mathsolver.functions.base import *
from sympy import sqrt


# 弦长公式
class LengthOfChord(BaseFunction):
    def solver(self, *args):
        sumsofroots = args[0].sympify()
        mulofroots = args[1].sympify()
        xielv = args[2].sympify()
        xianchang = sqrt(1 + xielv ** 2) * sqrt(sumsofroots ** 2 - 4 * mulofroots)
        self.steps.append(["", "由弦长公式知弦长为%s" % (new_latex(xianchang))])
        return self


if __name__ == '__main__':
    pass
